const mongoose = require('mongoose')

const schema = new mongoose.Schema({
    title:{
        type: String,
        require: true
    },
    categories:[{
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'Category'
    }],
    content: {
        type: String
    },
    userId:{
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'User'
    },
    publicOr:{
        type: Boolean,
        require: true
    },
    cover:{
        type: String,
    },
    like: [{
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'User'
    }],
    views: Number,
    comment:[{
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'Comment'
    }]
}, {timestamps: {createdAt: 'created', updatedAt: 'updated'}})

module.exports = mongoose.model('Design', schema)